<?php
namespace App\Http\Controllers\Testti;
use Illuminate\Http\Request;
use App\Http\Controllers\BaseApiController;
use App\Services\Testti\TesttiService;

class TesttiController extends BaseApiController
{
    private $service;

    public function __construct(TesttiService $service)
    {
        //继承基类的构造方法
        parent::__construct();
        //依赖注入service
        $this->service = $service;
    }

    /**
     * @return \Illuminate\Http\JsonResponse
     * 查询所有题
     */
    public function sel()
    {
        return $this->service->sel();
    }
    public function selOne(Request $request)
    {
        $rule=['id' => 'required|integer|max:1000'];
        if($error=$this->validate($rule,$request))
        {
            return $error;
        }
        $data=$request->get("id");
//        echo $data;die;
       return  $this->service->selOne($data);
    }

}